﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Pages_StudentPages_StudentLogin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["id"] != null)
        {
            Response.Redirect("StudentsHome.aspx");
        }
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        StudentBUS st = new StudentBUS();
        string username = txtUserName.Text;
        string pass = txtPassword.Text;
        DataSet ds=st.studentLogin(username, pass);
        if (ds.Tables[0].Rows.Count>0)
        {
            Session["id"] = ds.Tables[0].Rows[0]["studentId"];
            Response.Redirect("StudentsHome.aspx");
        }
        else
        {
            Response.Redirect("StudentLogin.aspx");
        }
    }
}